<?php
/**
 * Article 操作类
 *
 */
class art_lib extends base {
	/**
		 * 获取动态
		 *
		 * @param unknown_type $size
		 * @param unknown_type $cont
		 * @return unknown
		 */
	public static function getArt($size=10,$cont=array(),$order=" order by Id desc"){
		$result = array();
		$contstr = " where 1=1 ";
		foreach ($cont as $k=>$v){
			$contstr .= " and ".$k."='".$v."'";
		}
		$now = strtotime(date("Y-m-d",time()));
		$q = $GLOBALS['db']->query("select Id,title,dateline from ".tn("article")." $contstr $order limit $size");
		while ($row = $GLOBALS['db']->fetch_array($q)) {
			if( $now - strtotime(date("Y-m-d",$row['dateline'])) <= 86400 ){
				$row['isnew'] = true;
			}
			$result[] = $row;
		}
		return $result;
	}

}
?>